// Author: wsfuyibing <682805@qq.com>
// Date: 2025-06-13

package scan

import (
	"server/app/http/models"
	"server/app/http/responses"
)

// Response
// 出参.
type Response struct {
	Member  *responses.ArcadeMemberResponse  `json:",omitempty"`
	Setting *responses.ArcadeSettingResponse `json:",omitempty"`
	Records []*responses.TicketRecordResponse
	User    *responses.UserResponse
}

// NewResponse
// 创建结果.
func NewResponse() *Response {
	return &Response{
		Records: make([]*responses.TicketRecordResponse, 0),
	}
}

// AddRecord
// 添加记录.
func (o *Response) AddRecord(m *models.TicketRecord) {
	o.Records = append(o.Records,
		(&responses.TicketRecordResponse{}).With(m),
	)
}

// WithMember
// 绑定用户.
func (o *Response) WithMember(m *models.ArcadeMember) *Response {
	o.Member = (&responses.ArcadeMemberResponse{}).With(m)
	return o
}

// WithSetting
// 会员设置.
func (o *Response) WithSetting(m *models.ArcadeSetting) *Response {
	o.Setting = (&responses.ArcadeSettingResponse{}).With(m)
	return o
}

// WithUser
// 绑定用户.
func (o *Response) WithUser(m *models.Users) *Response {
	o.User = (&responses.UserResponse{}).With(m)
	return o
}
